home *** CD-ROM | disk | FTP | other *** search
/ Stickerpedia Stickerbook / Stickerbook.iso / pc / DATA / behaviours.cxt / 00032_Script_ [ global ] Button < prev   
Text File  |  2003-03-23  |  3KB  |  138 lines

  1.  
  2.  
  3.  
  4. global  oSpr
  5. global  gDontReact
  6. global  gCurrentCursor
  7.  
  8.  
  9.  
  10. property  spriteNum
  11. property  pChangeCursor
  12. property  pUpstate
  13. property  pLeaveState
  14. property  gDontReact
  15. property  pNoHilite
  16. property  pOriginalState
  17. property  pDisabled
  18.  
  19.  
  20.  
  21.  
  22. on beginSprite me
  23.   pDisabled = 0
  24. end
  25.  
  26. on disable me
  27.   -- this handler can be called to temporarily disable the script
  28.   -- for example from a handler which checks whether a text field is empty
  29.   
  30.   pDisabled = 1
  31.   
  32.   modify (oSpr, spriteNum, #std)
  33.   if rollover(spriteNum) then cursor -1
  34.   updatestage
  35. end
  36.  
  37.  
  38.  
  39. on enable me
  40.   -- this handler can be called to temporarily disable the script
  41.   -- for example from a handler which checks whether a text field is empty
  42.   
  43.   pDisabled = 0
  44.   
  45.   if rollover(spriteNum) then
  46.     cursor 280
  47.     modify (oSpr, spriteNum, #hiL)
  48.     updatestage
  49.   end if
  50. end
  51.  
  52.  
  53.  
  54.  
  55.  
  56. on mouseEnter me
  57.   
  58.   if gDontReact or pDisabled then exit
  59.   
  60.   if pChangeCursor then
  61.     cursor 280
  62.     gCurrentCursor = 280
  63.   end if
  64.   
  65.   if pNoHilite then exit
  66.   
  67.   pOriginalState = getState (oSpr, spriteNum)
  68.   if pOriginalState = #sel then exit
  69.   
  70.   
  71.   modify (oSpr, spriteNum, #hil)
  72.   
  73.   if pLeaveState = #asBefore then
  74.     pLeaveState =  pOriginalState
  75.   end if
  76.   
  77. end
  78.  
  79.  
  80.  
  81. on mouseLeave me
  82.   
  83.   if gDontReact or pDisabled then exit
  84.   
  85.   if pChangeCursor then 
  86.     cursor -1
  87.     gCurrentCursor = -1
  88.   end if
  89.   
  90.   if pNoHilite then exit
  91.   pOriginalState = getState (oSpr, spriteNum)
  92.   if pOriginalState = #sel then exit
  93.   
  94.   modify oSpr, spriteNum, pLeaveState
  95. end
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102. on mouseDown me
  103.   
  104.   if gDontReact or pDisabled then exit
  105.   
  106.   pOriginalState = getState (oSpr, spriteNum)
  107.   if pOriginalState = #sel then exit
  108.   
  109.   modify oSpr, spriteNum, #dwn  
  110.   updatestage
  111.   
  112.   repeat while the stillDown
  113.   end repeat
  114.   
  115.   
  116.   if rollover(spriteNum) then
  117.     modify oSpr, spriteNum, pUpstate
  118.     sendSprite spritenum, #msUp  
  119.   else
  120.     modify oSpr, spriteNum, pOriginalState
  121.   end if
  122.   
  123.   updatestage
  124.   
  125. end
  126.  
  127.  
  128.  
  129.  
  130. on getPropertyDescriptionList me
  131.   set description = [:]
  132.   addProp description, #pNoHilite,     [#comment: "No Hilite on rollover",         #format: #boolean, #default: 0]
  133.   addProp description, #pChangeCursor, [#comment: "Change cursor",                 #format: #boolean, #default: 1]
  134.   addProp description, #pUpstate,      [#comment: "State of button on mouseUp",    #format: #symbol,  #default: #hiL, #range:[#std, #hiL, #dwn, #sel, #ict, #none]]
  135.   addProp description, #pLeaveState,   [#comment: "State of button on mouseLeave", #format: #symbol,  #default: #std, #range:[#std, #hiL, #dwn, #sel, #ict, #none, #asBefore]]
  136.   return description
  137. end 
  138.